#pragma once

#include <iostream>
#include "Sort.h"

using namespace std;

class QuickSort : Sort {

public:
	QuickSort() {

	}

	~QuickSort() {

	}

	void m_Sort(int arr[], int low, int high) {

		if (low < high) {

			int i = low, j = high;
			int x = arr[low];

			while (i < j) {

				while (i < j && arr[j] >= x) {
					j--;
				}
				if (i < j) {
					arr[i++] = arr[j];
				}

				while (i < j && arr[i] <= x) {
					i++;
				}
				if (i < j) {
					arr[j--] = arr[i];
				}
			}

			arr[i] = x;
			m_Sort(arr, low, i - 1);
			m_Sort(arr, i + 1, high);
		}
	}


private:

};
